const Roter=require('koa-router');

const { updateDeptByID,getDepts,verifyCode,verifyName,addDept,getdeptDetail,deldeptByID} =require('../controller/dept.controller')
const {authToken } = require('../middleware/user.middleware')

const deptRouter = new Roter({
  prefix: '/dept'
});

deptRouter.get('/', authToken,getDepts)
deptRouter.post('/add', authToken,addDept) //增加部门：后期需要添加部门名称重复，编码重复校验的中间件
deptRouter.get('/:id', authToken,getdeptDetail)
deptRouter.delete('/:id', authToken,deldeptByID)
deptRouter.put('/:id', authToken,updateDeptByID)
deptRouter.post('/verifyCode', authToken,verifyCode)
deptRouter.post('/verifyName', authToken,verifyName)

module.exports = deptRouter;